package com;

public class 练习2 {
    public static void main(String[] args) {
    int arr[] = {121, 232, 333, 44, 55};
        int [] arrs =rs(arr);
        System.out.println("最大值" +arrs[0]);
        System.out.println("最小值" + arrs[1]);
}
    public static int[] rs(int[]arr) {
        int max = arr[0];
        int min = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        int [] maxAndMin = {max,min};
        return maxAndMin;


    }

}
